package com.qf.ithub.movie_demo01.controller;

import com.qf.ithub.common.result.R;
import com.qf.ithub.common.result.ResponseEnum;

import com.qf.ithub.movie_demo01.entity.Movie;
import com.qf.ithub.movie_demo01.service.MovieService;
import com.qf.ithub.movie_demo01.service.impl.MovieServiceImpl;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author : xixi
 * @Title :
 * @date :  2021-03-15 20:45
 */
@RestController
@RequestMapping("/api")
@Api(description = "门户网站-电影接口")
@CrossOrigin("*")
@Slf4j
public class MovieController {

    @Autowired
    private MovieServiceImpl movieService;

    /*获得正在上映电影的集合*/
    @GetMapping("/movie/now")
    public R getNowList(){
        List<Movie> list = movieService.getNowPlaying();
        return new R(ResponseEnum.SUCCESS,list);
    }

    /*获得即将上映电影的集合*/
    @GetMapping("/movie/soon")
    public R getSoonList(){
        List<Movie> list = movieService.getSoonPlaying();
        return new R(ResponseEnum.SUCCESS,list);
    }
}
